import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import EmployeeManage from '../views/EmployeeManage.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/login',
    name: 'login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/LoginView.vue')
  },
  {
    path: '/employee',
    name: 'employee',
    component: () => import('../views/LayoutPage.vue'),  // 模板页面
    children: [
      {
        path: 'manage',
        name: 'employeeManage',
        component: () => import("@/views/EmployeeManage.vue")
      }
    ]
  },
  {
    path: '/category',
    name: 'category',
    component: () => import('../views/LayoutPage.vue'),  // 模板页面
    children: [
      {
        path: 'manage',
        name: 'categoryManage',
        component: () => import("@/views/CategoryManage.vue")
      }
    ]
  },
  {
    path: '/dish',
    name: 'dish',
    component: () => import('../views/LayoutPage.vue'),  // 模板页面
    children: [
      {
        path: 'manage',
        name: 'dishManage',
        component: () => import("@/views/DishManage.vue")
      }
    ]
  },
  {
    path: '/setmeal',
    name: 'setmeal',
    component: () => import('../views/LayoutPage.vue'),  // 模板页面
    children: [
      {
        path: 'manage',
        name: 'setmealmanage',
        component: () => import("@/views/SetmealManage.vue")
      }
    ]
  },
  {
    path: '/orders',
    name: 'orders',
    component: () => import('../views/LayoutPage.vue'),  // 模板页面
    children: [
      {
        path: 'manage',
        name: 'orderDetailsManage',
        component: () => import("@/views/OrderDetailsManage.vue")
      }
    ]
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
